package practise.hibernate.Service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import practise.hibernate.Service.MoiveSiteService;
import practise.hibernate.dao.MoiveDao;
import practise.hibernate.dao.MoiveSiteDao;
import practise.hibernate.persistence.MoiveSite;

import java.util.List;

@Service("moiveSiteService")
@Repository
@Transactional
public class MoiveSiteServiceImpl implements MoiveSiteService {
    @Autowired
    private MoiveSiteDao moiveSiteDao;

    @Override
    @Transactional(readOnly = true)
    public List<MoiveSite> findAllMoiveesites() {
        return moiveSiteDao.findAllMoiveesites();
    }

    @Override
    @Transactional(readOnly = true)
    public List<MoiveSite> findBySitenumber(Integer sitenumber) {
        return moiveSiteDao.findBySitenumber(sitenumber);
    }

    @Override
    @Transactional(readOnly = false)
    public void deleteMoive(int id) {
        moiveSiteDao.deleteMoive(id);
    }

    @Override
    @Transactional(readOnly = false)
    public MoiveSite merge(MoiveSite moiveSite) {
        return moiveSiteDao.merge(moiveSite);
    }
}
